<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .count{
            display: inline-block;
            border-radius: 50%;
            width: 150px;
            height: 150px;
            background: pink;
            line-height: 150px;
            text-align: center;
        }
    </style>
</head>
<body>
    <div id="app">
        <v-count :count="count" @updatemsg="updateMsg"></v-count>
        {{msg}}
    </div>
</body>
<script src="../js/vue.js"></script>
<script>

    var count = {
        props:["count"],
        data(){
            return {
                msg:"子组件的msg"
            }
        },
        template:`<span class="count" @click="clickFn">{{count}}</span>`,
        methods:{
            clickFn(){
                this.$emit("updatemsg",this.msg)
            }
        }
    }


    Vue.config.productionTip = false;
    var vm = new Vue({
        el:"#app",
        data:{
            count:0,
            msg:"父组件的msg"
        },
        components:{
            "v-count":count
        },
        methods:{
            updateMsg(msg){
                this.msg = msg
            }
        }
    })
</script>
</html>